<!-- 首页 -->
<template>
  <div class="home-page">
    <!-- banner -->
    <el-carousel height="700px">
      <el-carousel-item v-for="(item,index) in bannerList" :key="index">
        <el-image style="width: 100%; height: 100%" :src="item.bannerUrl" fit="fit" lazy></el-image>
      </el-carousel-item>
    </el-carousel>
    <!-- 搜索卡片 -->
    <el-row type="flex" justify="center" class="search-phone-code">
      <el-row class="middle-content" type="flex" align="middle">
        <el-col :span="11" class="search">
          <el-row>
            <el-input placeholder="请输入内容" v-model="searchData" class="search-input">
              <el-button slot="append" icon="el-icon-search" @click="searchChange"></el-button>
            </el-input>
          </el-row>
          <el-row>
            热门搜索：
            <span
              v-for="(item,index) in hotKeyWord"
              :key="index"
              style="padding-right:10px"
              class="hot-key-word"
              @click="searchChange(item.itemText)"
            >{{item.itemText}}</span>
          </el-row>
        </el-col>
        <el-col :span="8" class="phone">
          <el-row type="flex" align="middle" justify="center">
            <el-col class="img-box">
              <img src="../../assets/img/icon_phone.png" alt />
            </el-col>
            <el-col class="phone-info">
              <span>全国统一服务热线</span>
              <span class="num">400-000-XX00</span>
            </el-col>
          </el-row>
        </el-col>
        <el-col :span="5" class="code">
          <el-row type="flex" align="center">
            <el-col>
              扫一扫
              <br />关注官方公众号
            </el-col>
            <el-col class="img-box">
              <img src alt />
            </el-col>
          </el-row>
        </el-col>
      </el-row>
    </el-row>
    <!-- 免责声明 -->
    <el-row type="flex" justify="center" class="statement" v-if="disclaimers">
      <el-col class="middle-content">
        <el-row type="flex" align="middle">
          <el-col class="title" :span="3">
            <img src="../../assets/img/icon_horn.png" alt />
            <span>免责声明</span>
          </el-col>
          <el-col
            :span="21"
            class="disclaimers"
            @click.native="herfto('info',{HomeType: 0,HomeId: disclaimers.id})"
          >{{disclaimers.content}}</el-col>
        </el-row>
      </el-col>
    </el-row>
    <!-- 新闻公告 -->
    <el-row type="flex" justify="center" class="notice">
      <el-col class="middle-content">
        <el-row type="flex" justify="center" class="title">
          <div>Notice notice</div>
          <div>
            <div class="line"></div>
            <div class="txt">新闻公告</div>
          </div>
        </el-row>
        <el-row type="flex" justify="center">
          <el-row class="tab" type="flex" align="middle">
            <el-col :span="12">
              <div @click="noticeNavChange(1)">
                <img src="../../assets/img/icon_news_d.png" v-show="noticeNav==2" alt />
                <img src="../../assets/img/icon_news.png" v-show="noticeNav==1" alt />
                <div :class="noticeNav==1?'noticeNavActiv':''">
                  <span>通知公告</span>
                  <span>Notice notice</span>
                </div>
              </div>
            </el-col>
            <el-col :span="12">
              <div @click="noticeNavChange(2)">
                <img src="../../assets/img/icon_news_d.png" v-show="noticeNav==1" alt />
                <img src="../../assets/img/icon_news.png" v-show="noticeNav==2" alt />
                <div :class="noticeNav==1?'':'noticeNavActiv'">
                  <span>新闻资讯</span>
                  <span>News</span>
                </div>
              </div>
            </el-col>
          </el-row>
        </el-row>
        <el-row type="flex" class="news-content">
          <el-col class="news-content-left">
            <div class="img-box">
              <img src='../../assets/img/home_notice_left_img.png' alt />
            </div>
          </el-col>
          <el-col class="news-content-right">
            <el-table
              :data="noticeList"
              @row-click="rowClick"
              v-if="noticeList"
              style="width: 100%"
              :show-header="false"
            >
              <el-table-column prop="title"></el-table-column>
              <el-table-column prop="createTime" width="110"></el-table-column>
            </el-table>
          </el-col>
        </el-row>
        <el-row type="flex" justify="center">
          <div class="more-btn margiB" @click="herfto('info',{HomeType:noticeNav==1?0:1})">MORE</div>
        </el-row>
      </el-col>
    </el-row>
    <!-- 业务介绍 -->
    <el-row type="flex" justify="center" class="business">
      <el-col class="middle-content">
        <el-row type="flex" justify="center" class="title">
          <div>Business</div>
          <div>
            <div class="line"></div>
            <div class="txt">业务介绍</div>
          </div>
        </el-row>

        <el-row class="business-content">
          <el-col :span="6">
            <el-popover
              placement="bottom"
              width="200"
              trigger="hover"
              content="为宜金所会员提供各类资产提供专业的交易服务平台，竞价、拍卖、协议转让多种交易方式，为参与方提供资产交易综合服务。"
            >
              <div slot="reference" class="item-flex">
                <div class="item1"></div>
                <div>
                  资产挂牌交易
                  <br />Listing of assets
                </div>
              </div>
            </el-popover>
          </el-col>
          <el-col :span="6">
            <el-popover
              placement="bottom"
              width="200"
              trigger="hover"
              content="为在中国境内依法注册的公司向具备相应风险识别和承担能力的合格投资者以非公开方式发行和转让债权融资计划产品提供挂牌备案服务，帮助企业扩大直接融资渠道。"
            >
              <div slot="reference" class="item-flex">
                <div class="item2"></div>
                <div>
                  债权融资计划
                  <br />Debt financing scheme
                </div>
              </div>
            </el-popover>
          </el-col>
          <el-col :span="6">
            <el-popover
              placement="bottom"
              width="200"
              trigger="hover"
              content="为企业面向合格投资者转让资产收益权提供挂牌登记服务，为企业盘活存量资产，实现资产保值增值提供一体化解决方案。"
            >
              <div slot="reference" class="item-flex">
                <div class="item3"></div>
                <div>
                  资产收益权
                  <br />Interest on assets
                </div>
              </div>
            </el-popover>
          </el-col>
          <el-col :span="6">
            <el-popover
              placement="bottom"
              width="200"
              trigger="hover"
              content="以交易平台为基础，整合优质资源，为企业提供财务顾问、项目融资、上市辅导、并购重组等一站式融资解决方案和增值服务。"
            >
              <div slot="reference" class="item-flex">
                <div class="item4"></div>
                <div>
                  投资银行
                  <br />Investmfnt bank
                </div>
              </div>
            </el-popover>
          </el-col>
        </el-row>
      </el-col>
    </el-row>
    <!-- 公司介绍 -->
    <el-row type="flex" justify="center" class="company">
      <el-col class="middle-content">
        <el-row type="flex" justify="center" class="title">
          <div>Company profile</div>
          <div>
            <div class="line"></div>
            <div class="txt">公司介绍</div>
          </div>
        </el-row>
        <el-row class="company-content">
          <img class="left" src="../../assets/img/home_comp_img.png" alt />
          <div class="right">
            <div>宜春联合信用资产交易中心</div>
            <div>打造金融生态圈，实现多方共赢</div>
            <div>宜春联合信用资产交易中心有限公司是经宜春市政府金融工作办公室批准设立的综合性金融资产交易平台，拥有国家财政部门指定的金融企业资产交易资质，是具有政府公信力的规范化、市场化、现代化的金融创新企业...</div>
            <div class="more-btn" @click="herfto('about')">MORE</div>
          </div>
        </el-row>
      </el-col>
    </el-row>
    <!-- 合作伙伴 -->
    <el-row type="flex" justify="center" class="enterprise">
      <el-col class="middle-content">
        <el-row type="flex" justify="center" class="title">
          <div>Enterprise</div>
          <div>
            <div class="line"></div>
            <div class="txt">合作伙伴</div>
          </div>
        </el-row>
        <el-row type="flex" justify="center" class="enterprise-content">
          <div></div>
        </el-row>
      </el-col>
    </el-row>
  </div>
</template>


<script>
import {getHomeBannerList, getHotKeyWord} from '@/api/home'
import {getZhengcefaguiList,getnewsXaingqign} from '@/api/zhengcefagui'

export default {
  components: {},
  props: {},
  data() {
    return {
      searchData: '',
      bannerList: null,
      hotKeyWord: null,
      noticeNav: 1,
      noticeList: null,
      disclaimers: null
    }
  },
  computed: {},
  watch: {},
  methods: {
    noticeNavChange(val) {
      this.noticeNav = val
      this.getNoticeList()
    },
    getDisclaimers() {
      getZhengcefaguiList({id:'1303895688500834306'}).then(res => {
        let {
          data: {
            code,
            message,
            result: {records},
            success
          }
        } = res
        if (code == 200 && success) {
          this.disclaimers = null
          this.disclaimers = records[0]
        }
      })
    },
    getNoticeList() {
      getZhengcefaguiList(Object.assign({pageSize: 5}, {firstType: this.noticeNav == 1 ? 'notice' : 'news'})).then(res => {
        let {
          data: {
            code,
            message,
            result: {records},
            success
          }
        } = res
        if (code == 200 && success) {
          this.noticeList = null
          this.noticeList = records
        }
      })
    },
    getKeyWord() {
      getHotKeyWord().then(res => {
        let {
          data: {result}
        } = res
        this.hotKeyWord = result.lenght > 4 ? result.slice(1, 4) : result
      })
    },
    getBanner() {
      getHomeBannerList().then(res => {
        let {
          data: {result}
        } = res
        this.bannerList = result
      })
    },
    searchChange(keyword) {
      this.searchData = keyword
      if (this.searchData) {
        this.$router.push({
          path: '/search',
          query: {
            keyword: this.searchData
          }
        })
      } else {
        this.$message.error('请输入关键字搜索')
      }
    },
    rowClick(row, column, event) {
      let item = {
        HomeType: this.noticeNav == 1 ? 0 : 1,
        HomeId: row.id
      }
      this.herfto('info', item)
    },
    herfto(name, item) {
      console.log(item)
      this.$router.push({
        path: `/${name}`,
        query: {
          ...item
        }
      })
    }
  },
  created() {
    this.getBanner()
    this.getKeyWord()
    this.getNoticeList()
    this.getDisclaimers()
  },
  mounted() {}
}
</script>


<style lang='less' scoped>
.noticeNavActiv {
  color: #163ea0 !important;
}
.hot-key-word {
  padding-right: 10px;
  cursor: Pointer;
}
.hot-key-word:hover {
  text-decoration: underline;
  color: #163ea0;
}
.disclaimers {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.margiB {
  margin-bottom: 100px;
}
.more-btn {
  width: 98px;
  height: 28px;
  color: #ffffff;
  text-align: center;
  line-height: 28px;
  background: #fbac0c;
  box-shadow: 5px 4px 13px 0px rgba(251, 172, 12, 0.32);
  border-radius: 14px;
}
// 标题
.middle-content {
  .title {
    position: relative;
    padding: 30px 0;
  }
  .title > div:first-child {
    font-size: 64px;
    font-weight: normal;
    color: #f2f2f2;
    line-height: 72px;
  }
  .title > div:last-child {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    .line {
      width: 37px;
      height: 1px;
      background: #000000;
    }
    .txt {
      font-size: 36px;
      color: #000000;
      line-height: 36px;
      padding-top: 32px;
    }
  }
}

// 合作伙伴
.enterprise {
  &-content {
    padding: 60px 0 100px 0;
    div {
      width: 940px;
      height: 360px;
      background-image: url('../../assets/img/home_enterprise.png');
      background-repeat: no-repeat;
      background-position: center;
    }
  }
}

// 公司介绍
.company {
  .middle-content {
    .title {
      padding-top: 88px;
    }
  }
  &-content {
    position: relative;
    height: 500px;
    .left {
      position: absolute;
      top: 0;
      left: 0;
      z-index: 99;
      width: 637px;
      height: 348px;
    }
    .right {
      box-sizing: border-box;
      padding: 45px 120px 0 238px;
      position: absolute;
      right: 0;
      top: 92px;
      z-index: 98;
      width: 755px;
      height: 326px;
      background: #f8f8fa;
      > div:nth-child(1) {
        font-size: 28px;
        color: #343434;
        line-height: 28px;
        padding-bottom: 18px;
      }
      > div:nth-child(2) {
        font-size: 16px;
        color: #666666;
        line-height: 16px;
        padding-bottom: 40px;
      }
      > div:nth-child(2)::after {
        content: '';
        display: block;
        width: 34px;
        height: 4px;
        background-color: #163ea0;
        border-radius: 2px;
        position: relative;
        top: 14px;
      }
      > div:nth-child(3) {
        font-size: 12px;
        color: #9a9a9a;
        line-height: 24px;
      }
      .more-btn {
        margin-top: 34px;
      }
    }
  }
}

// 业务介绍
.business {
  width: 100%;
  height: 578px;
  background-image: url('../../assets/img/home_business_bg.png');
  background-repeat: no-repeat;
  background-position: center;
  .middle-content {
    .title {
      padding-top: 88px;
    }
    .title > div:first-child {
      color: rgba(255, 255, 255, 0.07);
    }
    .title > div:last-child {
      .line {
        background: #ffffff;
      }
      .txt {
        color: #ffffff;
      }
    }
  }
  &-content {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 24px;
    text-align: center;
    margin-top: 48px;

    .item-flex {
      display: flex;
      flex-direction: column;
      align-items: center;
    }
    .item1 {
      width: 132px;
      height: 155px;
      margin-bottom: 20px;
      background-image: url('../../assets/img/icon_home_business.png');
      background-repeat: no-repeat;
      background-position: 0 0;
    }
    .item2 {
      width: 132px;
      height: 155px;
      margin-bottom: 20px;
      background-image: url('../../assets/img/icon_home_business.png');
      background-repeat: no-repeat;
      background-position: -264px 0;
    }
    .item3 {
      width: 132px;
      height: 155px;
      margin-bottom: 20px;
      background-image: url('../../assets/img/icon_home_business.png');
      background-repeat: no-repeat;
      background-position: -528px 0;
    }
    .item4 {
      width: 132px;
      height: 155px;
      margin-bottom: 20px;
      background-image: url('../../assets/img/icon_home_business.png');
      background-repeat: no-repeat;
      background-position: -792px 0;
    }
    .item1:hover {
      background-position: -132px 0;
    }
    .item2:hover {
      background-position: -396px 0;
    }
    .item3:hover {
      background-position: -660px 0;
    }
    .item4:hover {
      background-position: -924px 0;
    }
  }
}

// 新闻公告
.notice {
  .tab {
    margin: 20px 0;
    width: 610px;
    height: 88px;
    border-radius: 88px;
    background-color: #f2f2f2;
    > .el-col:first-child {
      border-right: 1px solid #ccc;
    }
    > .el-col {
      display: flex;
      align-items: center;

      > div {
        margin-left: 70px;
        display: flex;
        align-items: center;
        font-size: 18px;
        font-weight: bold;
        > div {
          display: flex;
          flex-direction: column;
          > span:last-child {
            padding-top: 8px;
            font-weight: 300;
            line-height: 18px;
          }
        }
      }
      img {
        width: 34px;
        height: 34px;
        margin-right: 20px;
      }
    }
  }
  .news-content {
    margin: 40px 0;
    font-size: 16px;
    line-height: 20px;
    &-left {
      width: 352px;
      margin-right: 36px;
      .img-box {
        width: 352px;
        height: 200px;
        img {
          width: 352px;
          height: 200px;
        }
      }

      > div:last-child {
        width: 352px;
        color: #606060;
        padding-top: 20px;
        text-overflow: -o-ellipsis-lastline;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
      }
    }
    &-right {
      /deep/ .el-table__row .cell {
        font-size: 16px;
        line-height: 20px;
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
        word-break: break-all;
      }
    }
  }
}

// 免责声明
.statement {
  position: relative;
  top: -32px;
  font-size: 16px;
  color: #666666;
  line-height: 16px;

  /deep/ .el-carousel__container span {
    display: block;
    width: 100%;
    line-height: 24px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /deep/ .el-carousel__indicators--vertical {
    display: none;
  }

  .middle-content > .el-row {
    padding: 12px 16px;
    height: 50px;
    background-color: #f7f7f7;
    .title {
      font-size: 16px;
      color: #ff664a;
      line-height: 16px;
      display: flex;
      align-items: center;
      img {
        width: 24px;
        height: 20px;
      }
      span {
        padding: 0 12px;
        border-right: 1px solid #999;
      }
    }
  }
}

// 搜索-电话-二维码
.search-phone-code {
  position: relative;
  z-index: 999;
  top: -80px;
}
.search-phone-code > .middle-content {
  box-sizing: border-box;
  padding: 32px 24px;
  background: #ffffff;
  box-shadow: 0px 0px 8px 0px rgba(95, 95, 95, 0.5);

  font-size: 14px;
  color: #9a9a9a;
  line-height: 24px;
  // 搜索
  .search {
    &-input {
      width: 360px;
      margin-bottom: 8px;
    }
  }
  // 电话
  .phone {
    &-info {
      display: flex;
      flex-direction: column;
    }
    .img-box,
    img {
      width: 56px;
      height: 56px;
    }
    .img-box {
      margin-right: 28px;
    }
    .num {
      font-size: 26px;
      color: #0e0d20;
      line-height: 32px;
    }
  }
  // 二维码
  .code {
    text-align: right;
    line-height: 18px;
    .img-box {
      margin-left: 15px;
    }
    .img-box,
    img {
      width: 88px;
      height: 88px;
    }
    > .el-row > .el-col:first-child {
      display: flex;
      align-items: center;
      justify-content: flex-end;
    }
  }
}

.home-page {
  background-color: #fff;
}

// banner
.el-carousel__item h3 {
  color: #475669;
  font-size: 14px;
  opacity: 0.75;
  line-height: 150px;
  margin: 0;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}
</style>